#include "buffer.h"
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>


//enum Commands {balance, deposit, withdrawal, create, close};


//struct request_struct {
//  int account;
//  float amount;
//  int command;
//  sem_t event;
//  char message [80];
//  int return_code;
//}; 
//
//typedef struct request_struct request;
//
request  read_request(int account, float amount, enum Commands command){
  request  r;
  r.account = account;
  r.amount = amount;
  r.command = command;
  sem_init(&r.event, 0, 0);
  return r;
}

enum Commands get_command(char c[]){

  if(c=="create") return CREATE;
  else if(c=="deposit") return DEPOSIT;
  else if(c=="withdrawal") return WITHDRAW;
  else if(c=="balance") return BALANCE;
  else if(c=="close") return ;




}


//struct buffer_struct {
//  sem_t empty;
//  //sem_init(&empty, 0, 0);
//  sem_t full;
//  //sem_init(&full, 0, 10);
//  sem_t lock;
//  //sem_init(&lock, 0, 1);
//  
//  request requests [10];
//  int cur_request;
//};


buffer make_buf(){
  buffer b;
  sem_init(&b.empty, 0, 0);
  sem_init(&b.full, 0, 10);
  sem_init(&b.lock, 0, 1);
  b.current_request = 0;
  return b;
}
//int main(){
//  buffer b;
//  b = make_buf();
//  request r;
//  //sem_wait(&b.lock);
//  sem_post(&b.lock);
//  return 0;
//}
